import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'
import Register from '../views/Register.vue' 
import Panel from '../views/Panel.vue';
import Home from "../components/Home.vue"; // 导入你的组件文件
import UserManagement from "../components/UserManagement.vue";
import MenuManagement from "../components/MenuManagement.vue";
import RoleManagement from "../components/RoleManagement.vue";
import PosterManagement from "../components/PosterManagement.vue";
import MaterialManagement from "../components/MaterialManagement.vue";

Vue.use(VueRouter)

const routes = [
  // 重定向login
  {
    path:'/',
    redirect:'/login'
  },
  {
    path:'/login',
    component:Login
  },
  {
    path:'/register',
    component:Register
  },
  { path: '/panel', component: Panel, children: [ // 主面板路由，包含子路由
    { path: '', redirect: 'home' }, // 默认重定向到首页
    { path: 'home', component: Home }, // 首页路由
    { path: 'userManagement', component: UserManagement }, // 用户管理路由
    { path: 'menuManagement', component: MenuManagement }, // 菜单管理路由
    { path: 'roleManagement', component: RoleManagement }, // 角色管理路由
    { path: 'posterManagement', component: PosterManagement }, // 海报管理路由
    { path: 'materialManagement', component: MaterialManagement }, // 素材管理路由
  ] },
]

const router = new VueRouter({
  routes
})

export default router
